package com.hydra.spring.springTest;

/**
 * @Created on 2013-7-25
 * @Title:
 * @Description:
 * @author:黄海军
 */
public class Singleton {
	public static Singleton singleton = new Singleton();// 实例化时，类还没完全初始化
	public static int b = 2;
	static {
		System.out.println(singleton.b);
	}
	public static int a;
	int c;// 成员变量
	static {
		System.out.println("aaaaaaaa");
	}
	int d = 1;// 成员变量

	/**
	 * 构造函数,实例化生成对象的时候调用
	 * 
	 * @Discription:
	 * @coustructor 方法.
	 */
	private Singleton() {
		// super();
		System.out.println("a:" + a);
		System.out.println("b:" + b);
		System.out.println("c:" + c);
		System.out.println("d:" + d);
		a++;
		// b++;
		c++;
		d++;
	}

	public static Singleton GetInstence() {
		return singleton;
	}

	public static void main(String[] args) {
		System.out.println("test");
		Singleton mysingleton = Singleton.GetInstence();
		System.out.println(mysingleton.a);
		System.out.println(mysingleton.b);
		System.out.println(mysingleton.c);
		System.out.println(mysingleton.d);
	}
}
